package com.stu.controller.student;

import com.stu.Dto.ComplaintDTO;
import com.stu.Dto.DormitoryRepairDTO;
import com.stu.pojo.DormitoryRepair;
import com.stu.result.Result;
import com.stu.serive.ComplaintService;
import com.stu.serive.DormitoryRepairService;
import com.stu.vo.ComplaintVo;
import com.stu.vo.DormitoryRepairVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/student")
public class DormitoryRepairController {

    @Autowired
    private DormitoryRepairService dormitoryRepairService;

    /**
     * 添加寝室维修信息
     * @param dormitoryRepairDTO
     * @return
     */
    @PostMapping("/dormitoryRepair")
    private Result insertDormitoryRepair(@RequestBody DormitoryRepairDTO dormitoryRepairDTO){
        dormitoryRepairService.insertDormitoryRepair(dormitoryRepairDTO);
        return Result.success();
    }

    /**
     * 查询寝室维修结果
     * @return
     */
    @GetMapping("/dormitoryRepair")
    private Result<List<DormitoryRepairVo>> selectDormitoryRepair(){
        return Result.success(dormitoryRepairService.selectDormitoryRepair());
    }



}
